]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
CyclerPopup: Check for type using constructor
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Thu, 18 Apr 2019 20:50:21 +0000 (15:50 -0500)
committerMarco Trevisan (Treviño) <mail@3v1n0.net>
Sat, 27 Apr 2019 01:48:52 +0000 (20:48 -0500)
Classes that are sub-classes of GObject don't use a constructor per se, so we
can't check for new.target (as this is undefined) in _init.

Then compare the current constructor name instead.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/503

js/ui/altTab.js

index fb9c875c81d0ccf105572873561a5be893b1fb61..0212992be61f7289fd31a1120362ee1fb791eaf6 100644 (file)
@@ -477,8 +477,8 @@ var CyclerList = GObject.registerClass({
 var CyclerPopup = GObject.registerClass(
 class CyclerPopup extends SwitcherPopup.SwitcherPopup {
     _init() {
-        if (new.target === CyclerPopup)
-            throw new TypeError('Cannot instantiate abstract class ' + new.target.name);
+        if (this.constructor.name === CyclerPopup.prototype.constructor.name)
+            throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`);
 
         super._init();